package cn.stronglink.asset.message.mq.dam.handle;

import cn.stronglink.asset.message.mq.dam.entity.ScreenCommandEntity;
import cn.stronglink.asset.message.mq.dam.message.MQMessageOfDAM;

public abstract class AbstractScreenCommandHandle extends AbstractReturnExceptionHandle {
	protected final static String ACTION_CODE="screenRequest";

	/**
	 * 获取命令编码
	 * @return
	 */
	protected abstract String getCommandCode();
	
	@Override
	public boolean isHandle(MQMessageOfDAM msg) {
		try {
		if(msg.getActioncode().equals(ACTION_CODE)) {
			ScreenCommandEntity sc = (ScreenCommandEntity) msg.getAwsPostdata();
			if(sc.getCommand().indexOf(this.getCommandCode())==0){
				return true;
			}
		}
		}catch(Exception e) {
			e.printStackTrace();
			logger.error(e.getMessage());
		}
		
		return false;
	}
}
